cmake_minimum_required(VERSION 3.10)
project(daemon)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(magic_enum REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(spdlog REQUIRED)

add_executable(daemon 
  src/main.cpp 
  src/event/gpio.cpp 
  src/event/init.cpp
  src/action/shell.cpp
  src/action/program.cpp
  src/action/close.cpp)
target_include_directories(daemon PRIVATE include)
target_link_libraries(daemon PRIVATE
  magic_enum::magic_enum 
  nlohmann_json::nlohmann_json 
  spdlog::spdlog
  asio_driver)
configure_file(config/rules.rule.json ${CMAKE_CURRENT_BINARY_DIR}/rules.rule.json COPYONLY)

install(TARGETS daemon RUNTIME DESTINATION bin)
configure_file(config/rules.rule.json ~/.daemon/rules.rule.json COPYONLY)

add_executable(example_program test/example_program.cpp)
target_link_libraries(example_program PRIVATE spdlog::spdlog)